#include "stdafx.h"
#include "ckEnumCheckElement.h"
#include "ckCheckElement.h"

namespace ck
{

	EnumCheckElement::EnumCheckElement()
	{
		m_iter = m_elements.begin();
	}


	EnumCheckElement::~EnumCheckElement()
	{
		Cleanup();
	}

	void EnumCheckElement::Add(CheckElement* pElement)
	{
		if (pElement)
		{
			m_elements.push_back(pElement);
		}
	}

	void EnumCheckElement::Cleanup()
	{
		std::vector<CheckElement*>::iterator iter;
		for (iter = m_elements.begin(); iter != m_elements.end(); iter++)
		{
			(*iter)->Release();
		}
		m_elements.clear();
	}

	void EnumCheckElement::Reset()
	{
		m_iter = m_elements.begin();
	}

	CheckElement* EnumCheckElement::Next()
	{
		if (m_iter == m_elements.end())
		{
			return NULL;
		}
		return *(m_iter++);
	}

}
